#!/bin/bash

if [[ -z "${ARGS[3]}" ]]; then
    plt_info "\${ARGS[3]} :: NOT_DEFINE :: return 1"
    return 1
fi

if ! [[ -d "${ARGS[3]}" ]]; then
    plt_info "\${ARGS[3]} :: NOT_DIR :: return 1"
    return 1
fi

a1="php_8000"
# a2="${ARGS[4]}"

echo "\${a1}='${a1}' is: name session "
# echo "\${a2}='${ARGS[4]}' is: ... "

# ptr_path="${a1}"
# ptr_path="$("${_abs_path}" "${PPWD}" "ptr_path")"

# if isn_yes__ "DO? ::XXX::ENTER or ^C"; then return 0; fi

#* arb2mm_ 1 1 1

kill -9 "$(lsof -t -i:8000)"

tm_k__ "${a1}"
tmux new -s "${a1}" -d
tmux split-window -h -t "${a1}":0.0

tmux send-keys -t "${a1}":0.0 "php -S localhost:8000 -t ${ARGS[3]}" Enter
sleep 3
tmux send-keys -t "${a1}":0.1 "links2 http://localhost:8000/" Enter

tm_a__

# tmux split-window -h -t "${a1}":0.1
# tmux send-keys -t "${a1}":0.1 'echo "that 1 window"' Enter
# tmux send-keys -t "${a1}":0.2 'echo "that 2 window"' Enter
